﻿<Application x:Class="EmployeeTracker.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>

        <Style TargetType="{x:Type DataGrid}">
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="SelectionMode" Value="Single" />
            <Setter Property="HorizontalGridLinesBrush" Value="DarkGray" />
            <Setter Property="VerticalGridLinesBrush" Value="Transparent" />
            <Setter Property="AlternatingRowBackground" Value="#FFEDEDED" />
        </Style>
        
        <Style TargetType="{x:Type ScrollViewer}" >
            <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
            <Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
        </Style>
        
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Height" Value="25" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="Margin" Value="3" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        
        <Style TargetType="{x:Type ComboBox}">
            <Setter Property="Height" Value="25" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="Margin" Value="3" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        
        <Style TargetType="{x:Type DatePicker}">
            <Setter Property="Height" Value="25" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="Margin" Value="3" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
               
        <!--Subtle border used to seperate areas of a pane-->
        <Style x:Key="DetailBorder" TargetType="{x:Type Border}">
            <Setter Property="Height" Value="Auto" />
            <Setter Property="BorderBrush" Value="LightGray" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="CornerRadius" Value="6" />
            <Setter Property="Padding" Value="2" />
        </Style>

        <!--Heavy pane with header, used to isolate major sections of the interface-->
        <Style x:Key="DisplayArea" TargetType="{x:Type HeaderedContentControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0" Background="#FF282828" BorderBrush="#FF282828"  Padding="8,2,8,6" CornerRadius="6,6,0,0" BorderThickness="4,4,4,0">
                                <TextBlock Foreground="LightGray" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <ContentPresenter ContentSource="Header"/>
                                </TextBlock>
                            </Border>
                            <Border Grid.Row="1" Background="White" BorderBrush="#FF282828" CornerRadius="0,0,6,6" BorderThickness="4,0,4,4">
                                <ContentPresenter/>
                                <Border.RenderTransform>
                                    <ScaleTransform x:Name="ContentScale" ScaleX="1" ScaleY="1" />
                                </Border.RenderTransform>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="HeaderedContentControl.Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ContentScale" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" To="0.0" BeginTime="0:0:0" Duration="0:0:0" AutoReverse="False"/>
                                        <DoubleAnimation Storyboard.TargetName="ContentScale" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" To="1.0" BeginTime="0:0:0.2" Duration="0:0:1" AutoReverse="False"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!--Light pane with header, used to isolate sub sections of the interface-->
        <Style x:Key="SubDisplayArea" TargetType="{x:Type HeaderedContentControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0" Background="LightGray" BorderBrush="LightGray"  Padding="8,2,8,6" CornerRadius="6,6,0,0" BorderThickness="2,2,2,0">
                                <TextBlock Foreground="#FF282828" HorizontalAlignment="Left" VerticalAlignment="Center">
                                    <ContentPresenter ContentSource="Header"/>
                                </TextBlock>
                            </Border>
                            <Border Grid.Row="1" Background="White" BorderBrush="LightGray" CornerRadius="0,0,6,6" BorderThickness="2,0,2,2">
                                <ContentPresenter/>
                                <Border.RenderTransform>
                                    <ScaleTransform x:Name="ContentScale" ScaleX="1" ScaleY="1" />
                                </Border.RenderTransform>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Modify TabControl to have the same look and feel as DisplayArea-->
        <Style TargetType="{x:Type TabControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <TabPanel Grid.Row="0" IsItemsHost="True" Background="Transparent" />
                            <Border Name="ContentPanel" Grid.Row="1" Background="White" BorderBrush="#FF282828" CornerRadius="0,6,6,6" BorderThickness="4">
                                <Border.RenderTransform>
                                    <ScaleTransform x:Name="TabItemScale" ScaleX="1" ScaleY="1" />
                                </Border.RenderTransform>
                                <ContentPresenter ContentSource="SelectedContent" />
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="TabControl.Loaded">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="TabItemScale" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" To="0.0" BeginTime="0:0:0" Duration="0:0:0" AutoReverse="False"/>
                                        <DoubleAnimation Storyboard.TargetName="TabItemScale" Storyboard.TargetProperty="(ScaleTransform.ScaleY)" To="1.0" BeginTime="0:0:0.2" Duration="0:0:1" AutoReverse="False"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid>
                            <Border Name="tabBorder" Background="#FF282828" BorderBrush="#FF282828" BorderThickness="1,1,1,0" CornerRadius="6,6,0,0" Padding="8,4,8,2" >
                                <TextBlock Name="tabForeground" Foreground="LightGray"  VerticalAlignment="Center" HorizontalAlignment="Center">
                                    <ContentPresenter ContentSource="Header" />
                                </TextBlock>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="tabBorder" Property="Background" Value="#FF282828" />
                                <Setter TargetName="tabForeground" Property="Foreground" Value="LightGray" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="False">
                                <Setter TargetName="tabBorder" Property="Background" Value="LightGray" />
                                <Setter TargetName="tabForeground" Property="Foreground" Value="#FF282828" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--Custom glossy button-->
        <LinearGradientBrush x:Key="GreenGloss" StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Color="#FF00E30A" Offset="0"/>
            <GradientStop Color="#FF039309" Offset="0.45"/>
            <GradientStop Color="#FF026B07" Offset="0.55"/>
            <GradientStop Color="#FF005003" Offset="1"/>
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="GreenGlossHover" StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Color="#FF00FB0B" Offset="0"/>
            <GradientStop Color="#FF029B08" Offset="0.45"/>
            <GradientStop Color="#FF007D05" Offset="0.55"/>
            <GradientStop Color="#FF006204" Offset="1"/>
        </LinearGradientBrush>
        <Style x:Key="GlossyButton" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Foreground" Value="#FFFFFFFF" />
            <Setter Property="Background" Value="{StaticResource GreenGloss}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border BorderThickness="1" CornerRadius="6" BorderBrush="#FE464646">
                            <Border Name="buttonBorder" BorderThickness="2" CornerRadius="4" BorderBrush="DarkGray">
                                <Border BorderThickness="1" BorderBrush="#FE464646" CornerRadius="3">
                                    <Border BorderThickness="1" BorderBrush="#FF009B06" CornerRadius="2" Background="{TemplateBinding Background}">
                                        <Grid>
                                            <ContentPresenter Name="buttonContent" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                        </Grid>
                                    </Border>
                                </Border>
                            </Border>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="{StaticResource GreenGlossHover}" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" Value="#FF006204" />
                                <Setter TargetName="buttonContent" Property="RenderTransform" >
                                    <Setter.Value>
                                        <TranslateTransform Y="1.0" />
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="True">
                                <Setter TargetName="buttonBorder" Property="BorderBrush" Value="LightGray" />
                            </Trigger>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter TargetName="buttonBorder" Property="BorderBrush" Value="LightGray" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="buttonBorder" Property="Opacity" Value="0.75" />
                                <Setter Property="Foreground" Value="LightGray" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>
